package ycl.base.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.base.entity.CarsAttribution;
import ycl.base.req.CarsAttributionReq;
import ycl.base.res.CarsAttributionRes;
import ycl.base.service.CarsAttributionService;
import ycl.common.ApiResult;
import ycl.common.base.controller.BaseController;
import ycl.common.models.base.A;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * <p>
 * 车辆归属地 前端控制器
 * </p>
 *
 * @author ycl
 * @since 2022-06-22 20:06:25
 */
@RestController
@RequestMapping("/cars-attribution")
@Api(tags = "车辆归属地")
@ApiSupport(order = 5)
public class CarsAttributionController
		extends BaseController<CarsAttribution, CarsAttributionReq, CarsAttributionRes> {


	@Resource
	private CarsAttributionService carsAttributionService;

	@Override
	public ApiResult<Page<CarsAttributionRes>> pageList(CarsAttribution carsAttribution) {
		return ApiResult.success(carsAttributionService.pageList(carsAttribution, CarsAttributionRes.class));
	}

	@Override
	public <E extends CarsAttributionReq> ApiResult<A> save(HttpServletRequest request, @Valid E e) {
		carsAttributionService.save(request, e, CarsAttribution.class);
		return ApiResult.success();
	}

	@Override
	public <E extends CarsAttributionReq> ApiResult<A> update(HttpServletRequest request, @Valid E e) {
		carsAttributionService.update(request, e, CarsAttribution.class);
		return ApiResult.success();
	}
}

